from common.base_page import BasePage
from page_locators.loginpage_locator import LoginPageLocator as LPL


class LoginPage(BasePage):

    def __init__(self, driver):
        super().__init__(driver)

    def login(self, name, pwd, code):
        self.input(LPL.username_loc, name)
        self.input(LPL.password_loc, pwd)
        self.input(LPL.verifycode_loc, code)
        self.click(LPL.loginbtn_loc)

    def login_fail_text(self):
        result = self.gettext(LPL.login_fail)
        return result

